package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BasePrivilege;
import com.briup.recognition.bean.BasePrivilegeExample;
import com.briup.recognition.dao.BasePrivilegeMapper;
import com.briup.recognition.service.IBasePrivilegeService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @program: recognition
 * @description:
 * @author: lipeian
 * @create: 2021-03-28 16:56
 **/

@Service
public class BasePrivilegeServiceImpl implements IBasePrivilegeService {

    @Resource
    private BasePrivilegeMapper basePrivilegeMapper;

    @Override
    public List<BasePrivilege> query() {
        BasePrivilegeExample example = new BasePrivilegeExample();
//        。。。
        return basePrivilegeMapper.selectByExample(example);
    }

    @Override
    public void savaOrUpdate(BasePrivilege basePrivilege) {
        if(basePrivilege.getId() != null){
            basePrivilegeMapper.updateByPrimaryKey(basePrivilege);
        }else {
            basePrivilegeMapper.insert(basePrivilege);
        }
    }

    @Override
    public void deleteById(long id) {
        basePrivilegeMapper.deleteByPrimaryKey(id);
    }
}
